|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
public interface SecureChannel
This defines an interface to be used by an Application that may want to delegate the handling of entity
authentication and APDU security to its associated Security Domain.
This interface is designed to offer interoperability to the Application in that it requires no knowledge
of the mechanisms used to perform the authentication or of the scheme used for APDU security and shall allow
an Application to interface correctly with a Security Domain immaterial of the mechanisms or schemes used.
Prior to using this interface, an Application is required to obtain a handle to its associated Security Domain’s
SecureChannel interface object by invoking the GPSystem.getSecureChannel() method.
The SecureChannel interface shall only be exposed through the GPSystem.getSecureChannel() method.
In all cases where the Application passes the APDU buffer as a parameter to the Security Domain, the class byte
of the APDU shall not be modified. This ensures that the Security Domain knows the logical channel number.
If the card supports logical channels, it is the responsibility of the Security Domain to correctly manage the
logical channel information when processing the APDU.
| Field Summary | |
|---|---|
static byte |
ANY_AUTHENTICATED
Entity Any Authentication has occurred (0x40). |
static byte |
AUTHENTICATED
Entity Authentication has occurred as Application Provider (0x80). |
static byte |
C_DECRYPTION
The unwrap method will decrypt incoming command data (0x02). |
static byte |
C_MAC
The unwrap method will verify the MAC on an incoming command (0x01). |
static byte |
NO_SECURITY_LEVEL
Entity Authentication has not occurred (0x00). |
static byte |
R_ENCRYPTION
The wrap method will encrypt the outgoing response data (0x20). |
static byte |
R_MAC
The wrap method will generate a MAC for the outgoing response data (0x10). |
| Method Summary | |
|---|---|
short |
decryptData(byte[] baBuffer,
short sOffset,
short sLength)
This method is used to decrypt data located in the input buffer. |
short |
encryptData(byte[] baBuffer,
short sOffset,
short sLength)
This method is used to encrypt data located in the input buffer. |
byte |
getSecurityLevel()
This method returns, from the requester's standpoint, the Current Security Level coded as a bit-map according to Table 10 1 indicating whether entity authentication has occurred and what level of security is currently applicable to command and response messages processed by the unwrap() and wrap() methods. |
short |
processSecurity(javacard.framework.APDU apdu)
Processes security related APDU commands. |
void |
resetSecurity()
This method is used to reset all information relating to the current Secure Channel Session. |
short |
unwrap(byte[] baBuffer,
short sOffset,
short sLength)
This method is used to process and verify the secure messaging of an incoming command according to the security level and Session Security Level of the current Secure Channel Session. |
short |
wrap(byte[] baBuffer,
short sOffset,
short sLength)
This method applies secure messaging to the current outgoing response according to the Current Security Level and Session Security Level of the Secure Channel Session. |
| Field Detail |
|---|
static final byte AUTHENTICATED
Note:
wrap
and unwrap methods are not necessarily related. A Security Domain, by default, could
verify the MAC on any command passed as a parameter in the unwrap method without
entity authentication previously having occurred.
static final byte C_DECRYPTION
unwrap method will decrypt incoming command data (0x02).
Note:
static final byte C_MAC
unwrap method will verify the MAC on an incoming command (0x01).
Note:
unwrap method will decrypt the command data of incoming commands
and verify the MAC on incoming commands.
static final byte R_ENCRYPTION
wrap method will encrypt the outgoing response data (0x20).
Note:
static final byte R_MAC
wrap method will generate a MAC for the outgoing response data (0x10).
Note:
unwrap method will verify the MAC on incoming commands and that the
wrap method will generate a MAC on outgoing response data.
static final byte NO_SECURITY_LEVEL
Note:
wrap and unwrap methods are not necessarily related. A
Security Domain, by default, could verify the MAC on any command passed as a parameter in
the unwrap method without entity authentication previously having occurred.
wrap and unwrap methods will not apply any cryptographic
processing to command or response data.
static final byte ANY_AUTHENTICATED
Note:
wrap
and unwrap methods are not necessarily related. A Security Domain, by default, could
verify the MAC on any command passed as a parameter in the unwrap method without
entity authentication previously having occurred.
| Method Detail |
|---|
short processSecurity(javacard.framework.APDU apdu)
throws javacard.framework.ISOException
This method is used by an applet to process APDU commands that possibly relate to the security mechanism used by the Security Domain. As the intention is to allow an Application to be associated with a Security Domain without having any knowledge of the security mechanisms used by the Security Domain, the applet assumes that APDU commands that it does not recognize are part of the security mechanism and will be recognized by the Security Domain. The applet can either invoke this method prior to determining if it recognizes the command or only invoke this method for commands it does not recognize. The method sets the compulsory Session Security Level that is established at Secure Channel initiation and which is required for the whole Secure Channel Session. On successful initialization of the Secure Channel Session, the Current Security Level is set to the same value as the compulsory Session Security Level. The Current Security Level is updated (R-MAC or not) on the successful processing of the BEGIN R-MAC SESSION / END R-MAC SESSION commands.
Notes:
APDU buffer at offset ISO7816.OFFSET_CDATA.
The return code indicates the length and the applet is responsible for outputting this data.
apdu - the incoming APDU object.
javacard.framework.ISOException - with the following reason codes (other security mechanism
related status words may be returned):ISO7816.SW_CLA_NOT_SUPPORTED class byte is not recognized by the method.ISO7816.SW_INS_NOT_SUPPORTED instruction byte is not recognized by the method.
short wrap(byte[] baBuffer,
short sOffset,
short sLength)
throws java.lang.ArrayIndexOutOfBoundsException,
javacard.framework.ISOException
Notes:
R_MAC and/or R_ENCRYPTION;
R_MAC and/or R_ENCRYPTION, when complying with the
Secure Channel Protocol rules, this method will do no processing and the outgoing response message will remain as is in the APDU object.
The returned length of the “wrapped” data is set to the value of the sLength parameter minus 2 (indicating the status bytes are no
longer present at the end of the returned data);
setSecurityLevel() method).
If the method fails, the Current Security Level is reset to NO_SECURITY_LEVEL, but not the compulsory Session Security Level;
NO_SECURITY_LEVEL) or
if the corresponding session keys are not available.
baBuffer - the source of the data to be wrapped.sOffset - the offset within baBuffer of the data to wrap.sLength - the length of the data to wrap.
Notes:
javacard.framework.ISOException - java.lang.ArrayIndexOutOfBoundsException - java.lang.SecurityException - if baBuffer is not accessible in the caller’s context
e.g. baBuffer is not a global array nor an array belonging to the caller context.
short unwrap(byte[] baBuffer,
short sOffset,
short sLength)
throws javacard.framework.ISOException
Notes:
NO_SECURITY_LEVEL, AUTHENTICATED or ANY_AUTHENTICATED only is indicated,
when complying to the Secure Channel Protocol rules, this method will not attempt any secure messaging processing on the incoming command,
the incoming command will remain as is within the incoming APDU object and the returned length of the “unwrapped” data is set to the value
of the sLength parameter, otherwise a security error is returned;
unwrap() will result in the incoming command being reformatted within the
incoming APDU object with all data relating to the secure messaging removed.
A reformatted case 1 or case 2 command will include an Lc byte set to zero;
unwrap method will result in the information relating to the current Secure Channel being reset.
NO_SECURITY_LEVEL) or
if the corresponding session keys are not available;
setSecurityLevel() method).
If the method fails, the Current Security Level is reset to NO_SECURITY_LEVEL, but not the compulsory Session Security Level.
baBuffer - the source of the data to be unwrapped.sOffset - the offset within baBuffer of the APDU data to unwrap, i.e. the offset of the command header.sLength - the length of the APDU data to unwrap, i.e the length of the command header and data field.
javacard.framework.ISOException - with the following reason code (other security mechanism related
status words may be returned):ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED if secure messaging verification failed.ISO7816.SW_CLA_NOT_SUPPORTED class byte is not recognized by the method.java.lang.SecurityException - baBuffer is not accessible in the caller’s context
e.g. baBuffer is not a global array nor an array belonging to the caller context.
short decryptData(byte[] baBuffer,
short sOffset,
short sLength)
throws javacard.framework.ISOException
Notes:
baBuffer - the source byte array.sOffset - offset within the source byte array to start the decryption.sLength - the number of bytes to decrypt.
javacard.framework.ISOException - with the following reason codes:
ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED if a Secure Channel Session has not been opened.ISO7816.SW_WRONG_LENGTH if the length of data to be decrypted is not valid.java.lang.SecurityException - baBuffer is not accessible in the caller’s context
e.g. baBuffer is not a global array nor an array belonging to the caller context.
short encryptData(byte[] baBuffer,
short sOffset,
short sLength)
throws java.lang.ArrayIndexOutOfBoundsException
Notes:
baBuffer - the byte array containing the data to be processed.sOffset - offset within the byte array to start the encryption.sLength - the number of bytes to encrypt.
java.lang.ArrayIndexOutOfBoundsException - javacard.framework.ISOException - with the following reason code:
ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED if a Secure Channel Session is not open.java.lang.SecurityException - if baBuffer is not accessible in the caller’s context
e.g. baBuffer is not a global array nor an array belonging to the caller context.void resetSecurity()
Notes:
Applet.deselect() method;
byte getSecurityLevel()
unwrap() and wrap() methods.
Notes:
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||